package com.ruoyi.web.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

//@Component
//public class MesMetaObjectHandler implements MetaObjectHandler {
//    @Override
//    public void insertFill(MetaObject metaObject) {
//        // 在插入操作时自动填充的字段
////        this.strictInsertFill(metaObject, "createTime", Date.class, DateUtils.getNowDate());
////        this.strictInsertFill(metaObject, "createBy", String.class, SecurityUtils.getUsername());
//
//        this.setFieldValByName("createTime", DateUtils.getNowDate(), metaObject);
//        this.setFieldValByName("createBy", SecurityUtils.getUsername(), metaObject);
//    }
//
//    @Override
//    public void updateFill(MetaObject metaObject) {
//        // 在更新操作时自动填充的字段
////        this.strictUpdateFill(metaObject, "updateTime", Date.class, DateUtils.getNowDate());
////        this.strictUpdateFill(metaObject, "updateBy", String.class, SecurityUtils.getUsername());
//        this.setFieldValByName("updateTime", DateUtils.getNowDate(), metaObject);
//        this.setFieldValByName("updateBy", SecurityUtils.getUsername(), metaObject);
//    }
//}
